package com.sjn.Client;

import com.sjn.arm.ARMcomposingRoom;

import java.util.Scanner;



public class armstart implements StartService{
    ARMcomposingRoom arMcomposingRoom = null;
    //收集框架
    String fr =null;
    //收集蓝图
    String bp = null;
    //制作
    String m = null;
    Scanner sc=new Scanner(System.in);

    @Override
    public String toString() {
        return "内存条{" +
                ", 框架='" + fr + '\'' +
                ", 蓝图='" + bp + '\'' +
                ", 制作情况='" + m + '\'' +
                '}';
    }

    @Override
    public void start(int proess){
        {
            //--------------------代工厂start----------------------
            while(proess==2){
                System.out.println("-----进入内存条制作界面-----");
                System.out.println("-----按1选择内存条代工厂-----");
                System.out.println("-----按2选择内存条蓝图-----");
                System.out.println("-----按3构造内存条框架------");
                System.out.println("-----按4选择进行内存条制作-----");
                System.out.println("-----按5结束制作进程------");
                int armproess = sc.nextInt();
                if (armproess==5){
                    System.out.println("内存条制作结束!");
                    break;
                }


                while(armproess == 1){
                    //搭建arm
                    //创建子线程用于选择代工厂
                    System.out.println("-----按1选择金士顿------");
                    System.out.println("-----按2选择台电------");
                    int armproesss = sc.nextInt();
                    arMcomposingRoom = new ARMcomposingRoom();
                    System.out.println("选择:" + arMcomposingRoom.Foundry(armproesss));
                    break;
                }
                //--------------------代工厂end----------------------
                //--------------------蓝图start----------------------
                while (armproess==2){
                    if (arMcomposingRoom==null){
                        System.out.println("添加失败,请先选择代工厂");
                        break;
                    }
                    System.out.println("------进入蓝图制作界面------");
                    System.out.println("------请依次输入整数x y 以及需要的技术:");
                    bp =  arMcomposingRoom.Blueprint(sc.nextInt(),sc.nextInt(),sc.nextLine());
                    System.out.println(bp);
                    if (bp!=null){
                        break;
                    }

                }
                //--------------------蓝图end----------------------
                //--------------------制作start----------------------
                while (armproess==4){
                    if (arMcomposingRoom==null){
                        System.out.println("添加失败,请先选择代工厂");
                        break;
                    }
                    System.out.println("------进入制作界面,cpu工厂自动制作-----");
                    m = arMcomposingRoom.Production();
                    System.out.println(m);
                    break;
                }
                //--------------------制作end----------------------
                //--------------------框架start----------------------
                while (armproess==3){
                    System.out.println("-----请按1选择4+64g-----");
                    System.out.println("-----请按2选择4+128g-----");
                    System.out.println("-----请按3选择6+64g-----");
                    System.out.println("-----请按4选择6+128g-----");
                    System.out.println("-----请按5选择8+128g-----");
                    System.out.println("-----请按6选择8+256g-----");
                    System.out.println("-----请按7结束添加-----");
                    int armproesss = sc.nextInt();

                    if (arMcomposingRoom==null){
                        System.out.println("添加失败,请先选择代工厂");
                        break;
                    }

                     if (armproesss==1&&fr==null){
                        fr = arMcomposingRoom.Frameworks(armproesss);
                        System.out.println(fr);
                         break;
                    }
                    else if (armproesss==2&&fr==null){
                         fr = arMcomposingRoom.Frameworks(armproesss);

                        System.out.println(fr);
                         break;
                    }
                    else if (armproesss==3&&fr==null){
                         fr = arMcomposingRoom.Frameworks(armproesss);

                         System.out.println(fr);
                         break;
                    }
                    else if (armproesss==4&&fr==null){
                         fr = arMcomposingRoom.Frameworks(armproesss);

                         System.out.println(fr);
                         break;
                    }
                    else if (armproesss==5&&fr==null){
                         fr = arMcomposingRoom.Frameworks(armproesss);

                         System.out.println(fr);
                         break;
                    }
                     else if (armproesss==6&&fr==null){
                         fr = arMcomposingRoom.Frameworks(armproesss);

                         System.out.println(fr);
                         break;

                     }
                    else if (armproesss==7){
                        break;
                    }
                     else {
                         System.out.println("添加失败");
                         break;
                     }






                }
                //--------------------框架end----------------------

            }

        }

    }
}
